package com.xindacloud.sms.adapter.constant;


@SuppressWarnings("unused")
public enum SmsError {

    /**
     * 空指针异常
     */
    BA_NULL_POINT("BA_E_001", "错误"),
    /**
     * Hystrix 超时
     */
    BA_HYSTIX_TIME_OUT("BA_E_002", "服务超时"),
    /**
     * Hystrix熔断
     */
    BA_HYSTIX_SHORTCIRCUIT("BA_E_003", "服务不可用,请稍后重试"),

    DB_EXCEPTION("DB_E_001", "后台服务异常."),

    PERSISTENCE_EXCEPTION("DB_E_002", "数据异常."),

    UNKNOW_EXCEPTION("BA_E_500", "服务异常."),

    /**
     * SmsClient异常
     */
    SMS_ERROR("SMS_E_001", "远端服务不可用"),
    SMS_CONFLICT_EXCEPTION("SMS_E_001", "请求配置存在冲突"),
    SMS_TOO_MANY_REQUESTS_EXCEPTION("SMS_E_002", "请求太频繁,请稍后重试"),
    SMS_UNAUTHORIZED_EXCEPTION("SMS_E_003", "权限不足"),
    SMS_LIMIT_EXCEEDED_EXCEPTION("SMS_E_004", "请求超出了速率限制,请稍后重试"),
    SMS_BAD_REQUEST_EXCEPTION("SMS_E_005", "请求错误,输入参数不完整或不支持或不正确"),
    SMS_ALREADY_EXISTS_EXCEPTION("SMS_E_006", "请求名称的资源已存在"),
    SMS_TOKEN_ALREADY_EXISTS_EXCEPTION("SMS_E_007", "客户端TOKEN已经存在"),
    SMS_INSUFFICIENT_CAPABILITIES_EXCEPTION("SMS_E_008", "该模板包含未在Capabilities参数中指定的功能的资源");

    private String code;
    private String message;

    SmsError(String code, String message) {
        this.code = code;
        this.message = message;
    }

    public String code() {
        return this.code;
    }

    public String getTips() {
        return this.message + " (" + this.code + ")";
    }

    @Override
    public String toString() {
        return getTips();
    }
}
